export function createGradient( endColor,startColor='#FFFFFF', steps=20) {
    const startRGB = hexToRgb(nameToHex(startColor));
    const endRGB = hexToRgb(nameToHex(endColor));
    const stepR = (endRGB[0] - startRGB[0]) / (steps - 1);
    const stepG = (endRGB[1] - startRGB[1]) / (steps - 1);
    const stepB = (endRGB[2] - startRGB[2]) / (steps - 1);
  
    const gradient = [];
    for (let i = 0; i < steps; i++) {
      const r = Math.round(startRGB[0] + stepR * i);
      const g = Math.round(startRGB[1] + stepG * i);
      const b = Math.round(startRGB[2] + stepB * i);
      gradient.push(rgbToHex(r, g, b));
    }
  
    return gradient;
  }
  const nameToHex = (name: string) => {
    const colors = {
        'green': '#47b747',
        'red': '#ff8d96',
        'cyan': '#30d3d9',
        'blue': '#3875f9',
        'geekblue': '#7b8cdb',
        'purple': '#08979c',
        'orange': '#e7b451',
    }
    return colors[name] || name
}
  function hexToRgb(hex) {
    const bigint = parseInt(hex.slice(1), 16);
    const r = (bigint >> 16) & 255;
    const g = (bigint >> 8) & 255;
    const b = bigint & 255;
    return [r, g, b];
  }
  
  function rgbToHex(r, g, b) {
    return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
  }
  